package com.training.bt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.training.bt.entity.PrivateMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PrivateMessageMapper extends BaseMapper<PrivateMessage> {
    // 获取两个用户之间的对话记录（按时间排序）
    List<PrivateMessage> getConversation(@Param("userId1")  Long userId1, @Param("userId2")  Long userId2);

    // 获取用户收到的未读消息数量
     Long countUnreadMessages(@Param("userId")  Long userId);

    // 将某个用户的消息标记为已读
    int markMessagesAsRead(@Param("userId")  Long userId, @Param("senderId")  Long senderId);
}